package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.List;

@Entity
public class Supplier {
    private Integer supplierId;
    private String supplierName;
    private String supplierPhone;
    private String supplierLxr;
    private List<Purchasexq> purchasexq;


    public Supplier() {
    }

    public Supplier(Integer supplierId, String supplierName, String supplierPhone, String supplierLxr) {
        this.supplierId = supplierId;
        this.supplierName = supplierName;
        this.supplierPhone = supplierPhone;
        this.supplierLxr = supplierLxr;
    }

    @Id
    @Column(name = "supplier_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "tmq",
            initialValue  =  1,allocationSize  =  1)
    public Integer getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Integer supplierId) {
        this.supplierId = supplierId;
    }

    @Basic
    @Column(name = "supplier_name")
    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    @Basic
    @Column(name = "supplier_phone")
    public String getSupplierPhone() {
        return supplierPhone;
    }

    public void setSupplierPhone(String supplierPhone) {
        this.supplierPhone = supplierPhone;
    }

    @OneToMany(mappedBy = "supplier")
    public List<Purchasexq> getPurchasexq() {
        return purchasexq;
    }

    public void setPurchasexq(List<Purchasexq> purchasexq) {
        this.purchasexq = purchasexq;
    }

    @Basic
    @Column(name = "supplier_lxr")
    public String getSupplierLxr() {
        return supplierLxr;
    }

    public void setSupplierLxr(String supplierLxr) {
        this.supplierLxr = supplierLxr;
    }


    @Override
    public String toString() {
        return "Supplier{" +
                "supplierId=" + supplierId +
                ", supplierName='" + supplierName + '\'' +
                ", supplierPhone='" + supplierPhone + '\'' +
                ", supplierLxr='" + supplierLxr + '\'' +
                ", purchasexq=" + purchasexq +
                '}';
    }
}
